package cn.swh.guguanjia.service.impl;

import cn.swh.guguanjia.entity.SysLog;
import cn.swh.guguanjia.mapper.SysLogMapper;
import cn.swh.guguanjia.service.SysLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional
public class SysLogServicelmpl extends BaseServicelmpl<SysLog, Long> implements SysLogService {

    @Autowired
    SysLogMapper logMapper;

    @Override
    public PageInfo<SysLog> selectPage(int pageNum, int pageSize, Map<String, Object> map) {
        PageHelper.startPage(pageNum,pageSize);
        List<SysLog> sysLogs = logMapper.selectPage(map);
        PageInfo<SysLog> pageInfo = new PageInfo<>(sysLogs);
        return pageInfo;
    }

    @Override
    //不加入其他事务中，不受其他事务回滚影响
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public int insertSelective(SysLog sysLog) {
        return super.insertSelective(sysLog);
    }



}
